#include <func.h>

int main(void)
{
    int pid = fork();
    
    switch(pid)
    {
        case -1:
            error(1,errno,"fork");
        case 0:

            printf("parent:pid = %d,child:pid = %d\n",getppid(),getpid());
            printf("Now Child Path 1:%s\n",getcwd(NULL,0));

            chdir("..");
            sleep(3);

            printf("Now Child Path 2:%s\n",getcwd(NULL,0));

            break;
        default:
            printf("parent:pid = %d,child:pid = %d\n",getpid(),pid);
            printf("Now Parent Path 1:%s\n",getcwd(NULL,0));

            sleep(3);

            printf("Now Parent Path 2:%s\n",getcwd(NULL,0));

            break;
    }
    return 0;
}
